package de.swta.freezay.admin.item;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.panel.Panel;

/**
 *
 * @author JKorreck
 */
public abstract class InDecreasePanel extends Panel {

    /**
     * Creates a new instance of type InDecreasePanel.
     *
     * @param id component id
     */
    public InDecreasePanel(String id) {
        super(id);

        /** Link to increase something. */
        add(new AjaxLink("increase") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                onIncrease(target);
            }
        });

        /** Link to decrease something. */
        add(new AjaxLink("decrease") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                onDecrease(target);
            }
        });
    }

    /**
     * Handles the actions after the increase-link was clicked.
     *
     * @param target AjaxRequestTarget.
     */
    public abstract void onIncrease(AjaxRequestTarget target);

    /**
     * Handles the actions after the decrease-link was clicked.
     *
     * @param target AjaxRequestTarget.
     */
    public abstract void onDecrease(AjaxRequestTarget target);

}
